<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	@@include('public/title.html')
	<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
	<link href="css/nifty.min.css" rel="stylesheet">
	<link href="../../css/demo/nifty-demo-icons.min.css" rel="stylesheet">
	<link href="../../plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
	<link href="../../css/user_defined.css" rel="stylesheet">
	<link href="../../plugins/pace/pace.min.css" rel="stylesheet">
	<script src="../../plugins/pace/pace.min.js?2016/8/5"></script>
	<script src="../../js/jquery-2.2.1.min.js"></script>
</head>

<!--TIPS-->
<!--You may remove all ID or Class names which contain "demo-", they are only used for demonstration. -->

<body id="main">
<div id="container" class="effect mainnav-lg">
	@@include('public/header.html')
	<div class="boxed">
		<div id="content-container">
			<div id="page-title">
				<h1 class="page-header text-overflow">区域开放设置</h1>
			</div>
			<div id="page-content">
				<button class="btn btn-default" data-toggle="modal" data-target="#myModal">添加开放区域</button>
			</div>
			
			<div class="row mar-top pad-top pad-all">
				<style>
					table {
						color: #999;
						margin:auto;
					}
					td,th{
						padding: 5px;
						border:1px solid #bbbbbb;
					}
					th{
						text-align: center;
						background: #e6e6e6;
						font-size:25px;
					}
					td div{
						padding:5px 15px;
						margin:5px;
						font-size:16px;
						border:1px solid #ccc;
						display:inline-block;
					}
					select{
						padding:5px;
						margin-right:20px;
					}
				</style>
				<table>
					<tr>
						<th width="500">区域</th>
					</tr>
					<tr>
						<td style="box-sizing:border-box;">
							<div v-if="regions.length==0" style="padding:20px;width:100%;margin:0;text-align:center;">暂未设置开放区域</div>
							<div v-for="r in regions" v-text="r.name"></div>
						</td>
					</tr>
				</table>
			</div>
		</div>
		
		<nav id="mainnav-container">
			@@include('public/left_menu.html')
		</nav>
	
	</div>
	
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">添加开放区域</h4>
				</div>
				<div class="modal-body" style="text-align:center;">
					<validator name="validation">
					<span>区域名称 : </span>
					<span>
						<input
							type="text"
							v-model="region"
							v-validate:region="{required:member.name}"
							autocomplete="off">
					</span>
					</validator>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="addBrand" v-on:click="save()">确定添加</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div>
</div>
@@include('public/footer.html')
<script>
	var vue = new Vue({
		el: '#main',
		data: {
			regions:[],
			region:""
		},
		methods: {
			save:function(){
				$.post(apiRecycle+"partner.php/Admin/Member/add_region", {
					region:vue.region
				}, function(res){
					if(res.code==200){
						location.reload();
					} else {
						alert(res.message);
					}
				}, "json");
			}
		},
		ready: function () {
			/*获取开放区域列表*/
			$.post(apiRecycle+"partner.php/Admin/Member/get_region", {}, function(res){
				vue.regions = res.data;
			}, "json")
		}
	});
</script>
</body>
</html>
